<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <base href="<%=request.getContextPath()%>/">
  <meta charset="UTF-8">
  <title>新增用户</title>
  <link rel="stylesheet" href="statics/css/newsStyle.css">
  <style>
    .error-message {
      color: red;
      margin-bottom: 15px;
      padding: 10px;
      background-color: #ffeeee;
      border: 1px solid #ffcccc;
      border-radius: 4px;
    }
  </style>
</head>
<body>
<%@include file="../common/sidebar.jsp"%>
<div class="main-content">
  <%@include file="../common/top.jsp"%>
  <div class="content">
    <div class="card">
      <h2 class="section-title">新增用户</h2>

      <!-- 错误提示 -->
      <c:if test="${not empty error}">
        <div class="error-message">
            ${error}
        </div>
      </c:if>

      <form action="user/add" method="post">
        <div class="form-group">
          <label>用户名：</label>
          <input type="text" name="userName" class="form-control" required>
        </div>
        <div class="form-group">
          <label>密码：</label>
          <input type="password" name="password" class="form-control" required>
        </div>
        <div class="form-group">
          <label>邮箱：</label>
          <input type="email" name="email" class="form-control" required>
        </div>
        <div class="form-group">
          <label>手机号：</label>
          <input type="text" name="phone" class="form-control">
        </div>
        <div class="form-group">
          <label>用户类型：</label>
          <select name="userType" class="form-control">
            <option value="0">普通用户</option>
            <option value="1">管理员</option>
          </select>
        </div>
        <div class="form-actions">
          <button type="submit" class="btn btn-primary">保存</button>
          <a href="user/find" class="btn btn-default">取消</a>
        </div>
      </form>
    </div>
  </div>
</div>
</body>
</html>